<html lang="zh">

<head>
    
    <meta charset="UTF-8">
    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Document</title>
</head>

<body>
    
</body>
<script>
    var grade = prompt("请输入你的年龄");
    if (grade >= 18) {
        alert("可以喝酒...");
    } else if (grade < 18) {
        alert("未成年禁止喝酒")
    }
</script>

</html>